package view;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;

import model.Manuscript;
import model.State;

@SuppressWarnings("serial")
/*
 * Action for creating a new review.
 * @author Jeff Kuhlman, Kevin Anderson
 */
public class NewReviewAction extends AbstractAction {
	
	/*
	 * Current state of user, including user id, conference,
	 * and role.
	 */
	private State my_state;
	private Manuscript my_manuscript;

	/**
	   * Constructs a new paper action.
	   */
	  public NewReviewAction(State the_state, Manuscript the_manuscript) {
	    super("Upload...");
	    putValue(Action.MNEMONIC_KEY, KeyEvent.VK_R);
	    putValue(Action.SELECTED_KEY, true);
	    my_state = the_state;
	    my_manuscript = the_manuscript;
	  }
	  
	  @Override
		public void actionPerformed(ActionEvent arg0) {
			JFrame new_review_frame = new JFrame("Please Upload Your Review");
			NewReviewPanel npp = new NewReviewPanel(my_state, new_review_frame, my_manuscript);
			
			new_review_frame.add(npp,BorderLayout.CENTER);
			new_review_frame.setResizable(true); 
			new_review_frame.pack();
			new_review_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
			new_review_frame.setLocationRelativeTo(null);
			new_review_frame.setVisible(true);
		}

}